package com.iotechn.unimall.data.dto.goods;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.iotechn.unimall.data.domain.UserShopDO;
import com.iotechn.unimall.data.dto.SuperDTO;
import lombok.Data;

import java.util.Arrays;
import java.util.List;

/**
 * @author kbq
 * @PackageName:com.iotechn.unimall.data.dto.goods
 * @ClassName: GroupShopDTO
 * @Description:
 * @date 19-11-13下午1:36
 */

@Data
public class ShopOneDTO extends SuperDTO {

    private Long spuId;

    /**
     * GroupShopSkuDTO列表
     */

    /**
     * spu属性
     */
    private Integer originalPrice;

    private Integer price;

    private Integer vipPrice;

    private String title;

    private Integer sales;

    private String img;

    private String detail;

    private String description;

    private Long categoryId;

    private Long freightTemplateId;

    private String unit;
    private String lgla;
    private String address;
    private String qrcode;
    private String shopName;
    private String realName;
    private Long shopId;
    private String area;
    private String pianarea;
    private String biaoduan;


    private String theDate; //日期
    private String zaoDate; //早打卡时间
    private String wanDate;//晚打卡时间
    private Integer type;
    private String dakaName;//打卡人
    private String companyName;//打卡公司

    private UserShopDO userShopDO;
    private String files;

    /**
     * 后面的图，仅在详情接口才出现
     */
    private List<String> fileList;
    private List<FileInfo> file;

    public List<FileInfo> getFile(){
        if(files!=null && !files.equals("")){
            Gson gson=new Gson();
            List<FileInfo> fileInfoList = gson.fromJson(files, new TypeToken<List<FileInfo>>(){}.getType());
            return fileInfoList;
        }
        return file;
    }
}

/**
 * SELECT
 *     shop_id as shopId,shop_name as shopName,daka_name as dakaName
 *     ,
 *   DATE(gmt_create) AS theDate,
 *    MIN(gmt_create) AS zaoDate,
 *    MAX(gmt_create) AS wanDate
 * FROM unimall_shop_qiandao
 * where type=2
 * and  gmt_create BETWEEN  and
 * GROUP BY shop_id, DATE(gmt_create)
 */